package com.test.service.impl;

import com.test.dao.IHouseMeterCurrentDao;
import com.test.dao.IHouseMeterHistoricalDao;
import com.test.model.HouseMeterCurrentData;
import com.test.model.HouseMeterHistoricalData;
import com.test.service.IHouseMeterHistoricalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ZZF on 2017/7/12.
 */
@Service
public class HouseMeterHistroicalServiceImpl implements IHouseMeterHistoricalService {

    @Autowired
    IHouseMeterHistoricalDao houseMeterHistoricalDao;
    @Autowired
    IHouseMeterCurrentDao houseMeterCurrentDao;

    @Override
    public void addHistorical(HouseMeterCurrentData houseMeterCurrentData) {

                HouseMeterHistoricalData historicalData = new HouseMeterHistoricalData();
                historicalData.setPlanTime(houseMeterCurrentData.getPlanTime());
                historicalData.setHouseMeterId(houseMeterCurrentData.gethouseMeterId());
                historicalData.setFlow(houseMeterCurrentData.getFlow());
                historicalData.setAccFlow(houseMeterCurrentData.getAccFlow());
                historicalData.setHeat(houseMeterCurrentData.getHeat());
                historicalData.setAccHeat(houseMeterCurrentData.getAccHeat());
                historicalData.setSupplyTemperature(houseMeterCurrentData.getSupplyTemperature());
                historicalData.setReturnTemperature(houseMeterCurrentData.getReturnTemperature());
                historicalData.setWorkTime(houseMeterCurrentData.getWorkTime());

                houseMeterHistoricalDao.save(historicalData);
            }
}
